package com.hippo.core.ui.compose.web

import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Modifier
import com.google.accompanist.web.WebView
import com.google.accompanist.web.rememberWebViewState
import com.hippo.core.core.manager.AppStore
import com.hippo.core.ui.components.CommonBody

@Composable
fun WebScreen(onBack: (() -> Unit)) {

    val url = AppStore.readString("web_url").orEmpty()
    val title = AppStore.readString("web_title").orEmpty()

    val webViewState = rememberWebViewState(url)

    CommonBody(
        title = title,
        onBack = onBack
    ) {

        WebView(
            state =  webViewState,
            onCreated = { it.settings.javaScriptEnabled = true }
        )


    }

}